package com.zjkj.mp.dao.finance.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.zjkj.mp.dao.DaoBase;
import com.zjkj.mp.dao.finance.FinanceItemDAO;
import com.zjkj.mp.utils.PaginatedResult;
import com.zjkj.mp.vo.finance.FinanceItem;

/**
 * 财务明细的DAO
 * @author wxd
 *
 */
@Repository
public class FinanceItemDAOImpl  extends DaoBase implements FinanceItemDAO{

	public void addItem(FinanceItem item) {
		getSqlMapClient().insert("insert.financeItem",item);
	}

	public PaginatedResult findList(int pageNo, int pageSize,Map<String, Object> params) {
		PaginatedResult result = new PaginatedResult(pageNo,pageSize);
		
		List list = this.getSqlMapClient().queryForList("get.financeItemList", params, (pageNo-1)* pageSize,pageSize);
		result.setResult(list);
		
		System.out.println(params.entrySet().size());
		
		Object count = this.getSqlMapClient().queryForObject("get.financeItemListCount", params);
		result.setTotalSize(count == null? 0: (Integer)count);
		
		return result;
	}
	 
}
